import java.util.concurrent.BlockingQueue;


public class WorkerA implements Runnable {
	private BlockingQueue<Integer> integers;
	private BlockingQueue<String> strings;
	
	int id;
	int number;

	public WorkerA(int the_id, BlockingQueue<Integer> the_integers, BlockingQueue<String> the_strings) {
		id = the_id;
		integers = the_integers;
		strings = the_strings;
	}
	
	private void addInt() {
		try {
			integers.put(number);
		} catch(InterruptedException e) { }
	}
	
	private void removeString() {
		try {
			String letter = strings.take();
			number = Integer.parseInt(letter);
		} catch(InterruptedException e) { }
	}
	
	@Override
	public void run() {
		removeString();
		//System.err.println("WorkerA " + id + " removed: " + number);
		addInt();
		//System.err.println("WorkerA " + id + " added: " + number);
		
	}
}